#include "app/app_mqtt.h"
#include <assert.h>
#include <string.h>
#include <unistd.h>


static int receive_flag = 0;

int recvCallback(char* str, int len) {
    receive_flag = 1;
    assert(memcmp(str, "Hello world!", len) == 0);
    return 0;
}

int main(void)
{
    App_mqtt_init();

    App_mqtt_reisterRecvCallback(recvCallback);

    // App_mqtt_send("Hello jack", 10);

    App_mqtt_send("Hello world!", 12);
    sleep(1);

    assert(receive_flag == 1);

    App_mqtt_close();
    return 0;
}
